import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import ElementUI from "element-plus"
import locale from "element-plus/es/locale/lang/zh-cn"
import "element-plus/dist/index.css"
//引入 font-awesome
import 'font-awesome/css/font-awesome.min.css'
import axios from 'axios'
import echarts from 'echarts'
import service from "./service"
//全局导航守卫之登录拦截
router.beforeEach((to, from, next) => {
    if (!localStorage.getItem("token")) {
        if (to.path !== "/login") {
            next("/login")
        }
        next()
    }
    next()
});
// createApp(App).use(router).mount('#app')
const app = createApp(App)
app.config.globalProperties.$http = axios
app.config.globalProperties.service = service
app.config.globalProperties.$echarts = echarts
app.use(ElementUI, { locale }).use(router).mount('#app')